﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Amazon.DynamoDBv2.Model;
using AmazonDynamoDBStub.Extensions;

namespace AmazonDynamoDBStub.Models
{
    public static class DynamoDBAttributeFactory
    {
        public static DynamoDBAttribute Create(string tableName, Guid rowId, KeyValuePair<string, AttributeValue> attribute)
        {
            return Create(tableName, rowId, attribute.Key, attribute.Value);
        }

        public static DynamoDBAttribute Create(string tableName, Guid rowId, KeyValuePair<string, AttributeValueUpdate> attribute)
        {
            return Create(tableName, rowId, attribute.Key, attribute.Value.Value);
        }

        public static DynamoDBAttribute Create(string tableName, Guid rowId, string attributeName, AttributeValue attributeValue)
        {
            return new DynamoDBAttribute
            {
                TableName = tableName,
                RowId = rowId,
                AttributeName = attributeName,
                AttributeValue = attributeValue.GetAttributeValue(),
                AttributeType = attributeValue.GetAttributeType()
            };
        }
    }
}
